/**
 * Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 * Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://opensource.org/licenses/MIT
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */

@import '../../../css/variable.css';
@import '../../../css/mixins/clearfix.css';
@import '../../../css/mixins/scroller.css';

.node-searcher {
    position: relative;
    width: 100%;
    border: 1px solid $borderWeightColor;
    background-color: #fff;
    border-radius: 2px;

    .searcher {
        height: 36px;
        border-radius: 2px;
        font-size: 14px;
        position: relative;
        z-index: 1;
        background: #fff;
        cursor: pointer;
        white-space: nowrap;
        margin: 0 4px;
        overflow: hidden;
        overflow-x: scroll;

        &::-webkit-scrollbar {
            display: none;
        }

        &::-webkit-scrollbar-thumb {
            display: none;
        }
    }

    .node-searcher-dropdown-menu {
        position: absolute;
        z-index: 1001;

        .node-searcher-dropdown-content {
            min-width: 100%;
            height: auto;
            background-color: #fff;
            padding: 0;
            margin: 0;
            position: absolute;
            z-index: 50;
            border-radius: 2px;
            border: 1px solid $fnMinorColor;
            box-sizing: border-box;
            opacity: 0;
            box-shadow: 0 2px 6px rgba(51, 60, 72, 0.1);

            &.is-show {
                z-index: 2;
                opacity: 1;
                display: inline-block;
                height: auto;
                .node-searcher-dropdown-list {
                    overflow-y: auto;
                    overflow-x: hidden;
                }
            }

            .action {
                display: flex;
                line-height: 28px;
                -webkit-box-orient: horizontal;
                flex-direction: row;
                -ms-flex-pack: distribute;
                justify-content: space-around;
                align-items: center;
                -webkit-box-align: center;
                -ms-flex-align: center;
                pointer-events: auto;
                .btn {
                    flex: 1;
                    text-align: center;
                    border-top: 1px solid #dcdee5;
                    pointer-events: auto;
                    cursor: pointer;
                    font-size: 12px;
                    &:hover {
                        color: #3c96ff;
                    }
                    &.disabled {
                        color: #e6e6e6;
                        cursor: not-allowed;
                        &:hover {
                            color: #e6e6e6;
                        }
                    }
                    &:first-child {
                        border-right: 1px solid #dcdee5;
                    }
                }
            }
        }

        .node-searcher-dropdown-list {
            @mixin scroller;
            width: 100%;
            max-height: 320px;
            list-style: none;
            padding: 0;
            margin: 0;

            >li {
                min-width: 120px;

                a {
                    display: block;
                    line-height: 41px;
                    padding: 0 15px;
                    color: $fontWeightColor;
                    font-size: 14px;
                    text-decoration: none;
                    white-space: nowrap;
                    position: relative;

                    &.active,
                    &:hover {
                        background: $primaryLightColor;
                        color: #3c96ff;
                    }
                }

                .bk-icon {
                    position: absolute;
                    right: 10px;
                    top: 13px;
                    color: #3ede78;
                }
            }
        }
    }

    .search-params-wrapper {
        @mixin clearfix;
        @mixin scroller;
        height: 100%;
        line-height: 1;

        .input {
            padding: 0;
            border: 0;
            box-sizing: border-box;
            outline: none;
            height: 36px;
            width: 300px;
            margin: 0;
            &::-webkit-input-placeholder {
                color: #c3cdd7;
                font-size: 12px;
            }
            &:-moz-placeholder {
                color: #c3cdd7;
                font-size: 12px;
            }
            &:-ms-input-placeholder {
                color: #c3cdd7;
                font-size: 12px;
            }
        }

        .selectable {
            display: flex;
            cursor: pointer;
            border: 1px solid $borderWeightColor;
            font-size: 12px;
            border-radius: 2px;

            .name {
                background-color: #fff;
                border-right: 1px solid $borderWeightColor;
                padding: 7px 10px;
            }

            .value-container {
                background-color: #fafbfd;
                padding: 7px 8px 5px 0;
                &.edit {
                    padding: 0;
                    input {
                        height: 26px;
                        padding: 0px 5px 0 10px;
                    }
                }

                .value,
                .value-value {
                    display: inline-block;
                    padding: 0 5px 0 10px;
                    .value-item {
                        border-right: 1px solid #dde4eb;
                        margin-right: 5px;
                        padding: 0 5px 0 0;
                        &:last-child {
                            border-right: none;
                            margin-right: 0;
                            padding: 0;
                        }
                    }
                }

                .value-value {
                    padding: 0 5px 0 0;
                }

                .remove-search-params {
                    display: inline-block;
                    padding: 0;
                }

                i {
                    font-size: 10px;
                    position: relative;
                    top: 0;
                }
            }
        }

        >li {
            display: inline-block;
            cursor: pointer;
            position: relative;
            top: -1px;
            margin: 0;
            margin-right: 5px;
            &:nth-child(1) {
                margin-right: 3px;
            }
        }

        .key-node {
            background: $primaryLightColor;
            padding-right: 16px;

            .remove-key {
                display: inline-block;
            }
        }

        .remove-key {
            position: absolute;
            width: 16px;
            height: 16px;
            line-height: 16px;
            bottom: 5px;
            right: 3px;
            display: inline-block;
            font-size: 12px;
            text-align: center;
            color: $fontColor;
            display: none;
        }
    }
}
